package com.yanqu.road.server.cmd.activity.carptrip;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.CarpTripProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.carptrip.CarpTripActivity;
import com.yanqu.road.server.manager.activity.carptrip.CrossCarpTripActivityMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CARP_TRIP_UPLOAD_ABILITY, desc = "同步玩家实力")
public class CrossCarpTripPVPAbilityUploadCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CarpTripProto.CarpTripPVPAbilityUploadMsg uploadMsg = CarpTripProto.CarpTripPVPAbilityUploadMsg.parseFrom(packet.getBytes());
        CarpTripActivity activity = CrossCarpTripActivityMgr.getCarpTripActivity(uploadMsg.getActivityId());
        if(activity != null){
            activity.updateAbility(uploadMsg.getUserId(), uploadMsg.getAbility());
        }
    }

    @Override
    public void sendData() {

    }
}
